﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quản Lý Phòng Trọ</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php
	require_once("connect.php");
	try
	{
		$sql="select tenphong from phong";
		
		$result=$conn->prepare($sql,array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
    	$result->execute();
		if($result->rowCount()==0)
			echo "Không có dữ liệu";
   		while($row=$result->fetch(PDO::FETCH_ASSOC))
		{
			?>
			<span class="room">
               	<div class="label"> 
					<?php
                       echo $row["tenphong"];
                    ?>
               	</div>
             </span>
             <?php	
		}
    	$result=null;
			
	}
	catch(Exception $ex)
	{ 
		echo "Error in query preparation/execution.<br/>".print_r( $ex->getMessage(), true);
	}
?>
</body>
</html>